***** Political Trust and Support for Immigration in the American Mass Public *****

**** Replication File to Generate the Results in Tables 2-7 ****

*** Tables 2, 3, and 4 | 2016 ANES ***
clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final 2016 ANES data.dta"

*Table 2*
reg imm5_factor01 trust_factor01 online_mode female age white i.educ3 married own_home income_cat01 parents_born_us nat_econ_retro01 personal_econ_retro01 ///
partyid01 Ideology01 auth_factor01 egal_factor01 moral_factor01 ft_asians01 ft_hispanics01 ft_blacks01 ft_whites01 ft_muslims01 ///
i.state_fips , cluster(state_fips)

outreg2 using table2.tex, replace dec(3) sideway

*Table 3*
reg imm5_factor01 trust_factor01 online_mode female age white i.educ3 married own_home income_cat01 parents_born_us nat_econ_retro01 personal_econ_retro01 ///
partyid01 Ideology01 auth_factor01 egal_factor01 moral_factor01 ft_asians01 ft_hispanics01 ft_blacks01 ft_whites01 ft_muslims01 ///
i.state_fips , beta

outreg2 using table3.tex, replace dec(3) sideway

*Table 4, Column 1*
reg imm5_factor01 trust_factor01 online_mode female age white i.educ3 married own_home income_cat01 parents_born_us nat_econ_retro01 personal_econ_retro01 ///
strong_Democrat Ideology01 auth_factor01 egal_factor01 moral_factor01 ft_asians01 ft_hispanics01 ft_blacks01 ft_whites01 ft_muslims01 ///
i.state_fips if pid7<=3 , cluster(state_fips)

outreg2 using table4.tex, replace dec(3) 

*Table 4, Column 2*
reg imm5_factor01 trust_factor01 online_mode female age white i.educ3 married own_home income_cat01 parents_born_us nat_econ_retro01 personal_econ_retro01 ///
strong_Republican Ideology01 auth_factor01 egal_factor01 moral_factor01 ft_asians01 ft_hispanics01 ft_blacks01 ft_whites01 ft_muslims01 ///
i.state_fips if pid7>=5 , cluster(state_fips)

outreg2 using table4.tex, append dec(3) 

*** Table 5 | 2012 ANES and CANES ***
clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final 2012 ANES data.dta"

*Table 5, Column 1*
reg immig3_factor01 trust_factor01 online_mode female age married i.educ3 white income_cat01 own_home parents_born_us nat_econ_retro01 personal_econ_retro01 ///
partyid01 Ideology01 ft_hispanics01 ft_blacks01 ft_whites01 ft_asians01 ft_muslims01 egal_factor01 moral_factor01 auth_factor01 /// 
i.state_fips  , cluster(state_fips)

outreg2 using table5.tex, dec(3) replace

clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final CANES data.dta"

*Table 5, Column 2*
oprobit immig_level5 trust4_factor01 partyid01 Ideology01 ft_hispanics01 ft_whites01 egal_factor01 moral_trad_factor01 ///
age female i.educ3 white own_home married income parents_born_us personal_econ_retro nat_econ_retro i.year i.state_fips , cluster(state_fips)

outreg2 using table5.tex, dec(3) append

*** Table 6 | 1990s, 2000s, 2010s Panels ***
clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final 1990s ANES panel data.dta"

*Model 1*
oprobit immig_level_96 trust_factor01_94 immig_level_94 , r

*Model 4*
reg trust_factor01_96 immig_level_94 trust_factor01_94 , r

clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final 2000s ANES panel data.dta"

*Model 2*
oprobit immig04 trust_factor01_2002 immig00 , r

*Model 5*
reg trust_factor01_2004 immig00 trust_factor01_2002 , r

clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final 2010s GSS panel data.dta"

*Model 3*
oprobit immig_2014 trust12_factor01 immig_2012, r

*Model 6*
reg trust14_factor01 immig_2012 trust12_factor01, r

*** Table 7 | MTurk survey experiment ***
clear
use "C:\Users\dmac9\Dropbox\BJPS Conditional Accept Trust and Immigration\Final MTurk data.dta"

*pos_treat = assigned to read the positively framed op-ed
*rpt = read positive treatment, meaning they were assigned to the positive condition and correctly answered 2 recall questions

*Table 7, Column 1*
reg immig_factor3_01 pos_treat , r

outreg2 using table7.tex, replace dec(3)

*Table 7, Column 2*
ivreg2 immig_factor3_01 (rpt = pos_treat), r

outreg2 using table7.tex, append dec(3)


